

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<script type="text/javascript" src="/agent/js/jquery.1.9.1.js" ></script>
<link href="https://res.wx.qq.com/open/libs/weui/1.1.2/weui-for-work.min.css" rel="stylesheet" >
<script type="text/javascript" src="/agent/js/layer.js"></script>
    <link rel="stylesheet" type="text/css" href="/agent/css/layer.css" />
<title>生成招募链接</title>
</head>
<style>
    .type1,.type2,.type3{display: none;}
    .weui-btn_reset{border: none;background-color: #fff;outline: none;}
    .weui-textarea{height: 150px;}
    .weui-cells{margin-top: 10px!important;}
    .weui-cell-date:before{border-top: none;}
</style>
<style>
.pingzheng{
  height: 100px;
  border-bottom: 1px solid #E8E8E8;
  border-top: 1px solid #E8E8E8;
  background: #fff;

}
.pingzheng p{
  height: 10px;
  line-height: 10px;
  padding: 10px 10px 0 16px;
}
.pingzheng p span{
  color: #f3494c;
  float: right;
}
.upload{
  width: 10px;
  height: 10px;
  border: 1px dashed #ccc;
  border-radius: 3px;
  color: #999;
  text-align: center;
  /*line-height: 0.9rem;*/
  font-size: 10px;
}
.z_file em{
  display: block;
  color: #999;
  font-size: 10px;
  font-style: normal;
  position: absolute;
  left: 32%;
  top: 60%;
}
.z_photo {
  width: 100px;
  height: auto;
  padding: 16px 16px 66px 16px;
  overflow: auto;
  clear: both;
}

.z_photo img {
  width: 50px;
  height: 50px;
}

.z_addImg {
  float: left;
  margin-right: 5px;
}
img.img_close{
  width: 5px;
  height: 5px;
  position: absolute;
  top: -5px;
  right: -5px;
}
.z_file {
  width: 50px;
  height: 50px;
  border: 1px dashed #ccc;
  border-radius: 3px;
  float: left;
  margin-right: 2px;
  position: relative;
}
.z_file span{
  position: absolute;
  color: #999;
  font-size: 20px;
  left: 36%;
  top: 3%;
}
.z_file input::-webkit-file-upload-button {
  width: 10px;
  height: 10px;
  border: none;
  position: absolute;
  outline: 0;
  opacity: 0;
}

.z_file input#file {
  display: block;
  width: 10px;
  height: 10px;
  border: 0;
  vertical-align: middle;
}
.headerBox{
  width: 10px;
  height: 10px;
  position: relative;
  background-size: 100% 100%;
  float: left;
  margin-right: 0.2rem;
}
.imgBox{
  width: 100%;
  height: 100%;
  
}
img.img_close{
     width: 10px;
    height: 10px;
    position: absolute;
    top: -5px;
    right: -45px;
}
</style>
<body ontouchstart="">
   <div class="weui-cells__title">展示类型</div>
         <div class="weui-cells weui-cells_radio">
            <label class="weui-cell weui-cell_active weui-check__label" for="x1">
                <div class="weui-cell__bd">
                    <p>二维码</p>
                </div>
                <div class="weui-cell__ft">
                    <input type="radio" class="weui-check" value="1" name="type" id="x1"/>
                    <span class="weui-icon-checked"></span>
                </div>
            </label>
            <label class="weui-cell weui-cell_active weui-check__label" for="x2">
                <div class="weui-cell__bd">
                    <p>海报</p>
                </div>
                <div class="weui-cell__ft">
                    <input type="radio" name="type" class="weui-check" value="2" id="x2"/>
                    <span class="weui-icon-checked"></span>
                </div>
            </label>
            <label class="weui-cell weui-cell_active weui-check__label" for="x3">
                <div class="weui-cell__bd">
                    <p>链接</p>
                </div>
                <div class="weui-cell__ft">
                    <input type="radio" name="type" class="weui-check" value="3" id="x3"/>
                    <span class="weui-icon-checked"></span>
                </div>
            </label>
            
        </div>
          <div class="weui-cell weui-cell_active weui-cell-date">
                <div class="weui-cell__hd"><label class="weui-label">来源名称</label></div>
                <div class="weui-cell__bd">
                    <input id="source" class="weui-input" placeholder="填写来源名称" type="text" >
                </div>
              </div>
      
<div class="weui-btn-area">
    <a href="javascript:;" class="weui-btn weui-btn_primary" id="showPicker">提交并生成</a>
</div>

<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script src="https://res.wx.qq.com/open/libs/weuijs/1.0.0/weui.min.js"></script>
<script type="text/javascript" class="picker js_show">
   $(function(){
 
      $('#showPicker').click(function(){
        var type = $('input[name="type"]:checked ').val();
         if(!type){
           layer.open({
                content: '请选择类型',
                skin: 'msg',
                time: 2 //2秒后自动关闭
              });
              return false;
         }
         var source = $('#source').val();
          if(source == ""||source == null){
              layer.open({
                content: '请填写来源名称',
                skin: 'msg',
                time: 2 //2秒后自动关闭
              });
              return false;
            }
          var index2 = layer.open({type: 2});
          $.ajax({
            type: 'post',
            url:"/index/tool/recruit" ,
            data:{type:'1',name:source,typexz:type},
            success: function(data){
              layer.close(index2);
              if(data.code){
                 layer.open({
                content:data.msg,
                skin: 'msg',
                time: 2 //2秒后自动关闭
              });
                 setTimeout(function () {
                   window.location.href = data.data;
                },1000);
              }else{
                if(data.msg == '来源已经存在,是否跳转'){
                      layer.open({
                      content: data.msg
                      ,btn: ['确定', '不要']
                      ,yes: function(index){
                        layer.close(index);
                        window.location.href = data.data;
                      }
                      ,no:function(index){
                        layer.close(index);
                      }
                    });
                  }else{
                       layer.open({
                          content:data.msg,
                          skin: 'msg',
                          time: 2 //2秒后自动关闭
                        });
                  }
               }
            
            }
          });
        });
  
    });
</script>

</body>
</html>